package com.zzptc.myapp1204.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.zzptc.myapp1204.R;
import com.zzptc.myapp1204.entity.QcGzInfo;

import java.util.Collections;
import java.util.List;

public class QcGzAdapter extends ArrayAdapter<QcGzInfo> {

    private int resourceid;
    List<QcGzInfo>list;


    public QcGzAdapter(@NonNull Context context, int resource, @NonNull List<QcGzInfo> objects) {
        super(context, resource, objects);
        this.resourceid=resource;
        this.list=objects;

    }


    @Override
    public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
        QcGzInfo resultDTO=getItem(position);

        //View view=convertView;
        if (convertView==null){
            convertView= LayoutInflater.from(getContext()).inflate(resourceid,null);

        }
        TextView tv_code=convertView.findViewById(R.id.tv_code);
        TextView tv_a=convertView.findViewById(R.id.tv_ac);
        TextView tv_b=convertView.findViewById(R.id.tv_bc);
        TextView tv_d=convertView.findViewById(R.id.tv_dc);
        TextView tv_e=convertView.findViewById(R.id.tv_ec);

        QcGzInfo resultDTO=getItem(position);
        tv_code.setText(resultDTO.getResult().getCode());
        tv_a.setText(resultDTO.getResult().getSycx());
        tv_b.setText(resultDTO.getResult().getGzfw());
        tv_d.setText(resultDTO.getResult().getZwhy());
        tv_e.setText(resultDTO.getResult().getMs());

        return  convertView;


        return super.getView(position, convertView, parent);
    }
}
